/********************************************************************************
 *      Copyright:  (C) 2022 dairongan<2974932606@qq.com>
 *                  All rights reserved.
 *
 *       Filename:  misc_api.h
 *    Description:  This head file 
 *
 *        Version:  1.0.0(07/31/2022)
 *         Author:  dairongan <2974932606@qq.com>
 *      ChangeLog:  1, Release initial version on "07/31/2022 12:08:09 PM"
 *                 
 ********************************************************************************/
#ifndef _MISC_API_H_
#define _MISC_API_H_

#define OLED_PATH "/dev/OLED"
#define TEMP_LIMIT 90               //温度预警值


extern void high_nemp_warning(int fd_oled);
extern void high_temp_diswarning(int fd_oled);
extern void oled_show_temp_hum_chinese(int fd_oled);
extern void oled_show_temp_hum_num(int fd_oled,float temp_f,float hum_f);
extern int pack_temp_hum(char *databuf,int size,float temp_f,float hum_f);
extern int mqtt_connect(struct mosquitto *mosq,s_mosquitto_data *mqtt_data);
extern int publish_message(struct mosquitto *mosq,s_mosquitto_data *mqtt_data,char *databuf);
extern void check_temp_limit(int fd_oled,float temp_f);
extern void dra_message_callback(struct mosquitto *mosq, void *obj, const struct mosquitto_message *msg);
extern int subscribe_message(struct mosquitto *mosq,s_mosquitto_data *mqtt_data);
extern int parse_sub_json(void *message);
extern int oled_open();
extern void oled_close(int fd);

#endif
